package com.jiudengnile.liushu.biz.dal.ibatis;

import java.util.List;

import com.jiudengnile.liushu.biz.dal.dao.BaseUserDAO;
import com.jiudengnile.liushu.biz.dal.ibatis.base.BaseIbatisDaoSupport;
import com.jiudengnile.liushu.biz.domains.BaseUserDO;

public class BaseUserDAOIbatis extends BaseIbatisDaoSupport implements BaseUserDAO {
	
	public long create(BaseUserDO baseUser) {
		return (Long)this.getSqlMapClientTemplate().insert("BaseUserDAO.create", baseUser);
	}

	public void delete(long id) {
		this.getSqlMapClientTemplate().update("BaseUserDAO.delete", id);
	}

	public void update(BaseUserDO baseUser) {
		this.getSqlMapClientTemplate().update("BaseUserDAO.update", baseUser);
	}

	public BaseUserDO queryById(long id) {
		return (BaseUserDO)this.getSqlMapClientTemplate().queryForObject("BaseUserDAO.queryById", id);
	}
	
	public BaseUserDO queryByNick(String nick) {
		return (BaseUserDO)this.getSqlMapClientTemplate().queryForObject("BaseUserDAO.queryByNick", nick);
	}
	
	public BaseUserDO queryByEmail(String email) {
		return (BaseUserDO)this.getSqlMapClientTemplate().queryForObject("BaseUserDAO.queryByEmail", email);
	}

	@SuppressWarnings("unchecked")
	public List<BaseUserDO> queryByIds(List<Long> ids) {
		return (List<BaseUserDO>)this.getSqlMapClientTemplate().queryForList("BaseUserDAO.queryByIds", ids);
	}

}
